package com.reflex.utils;

import com.reflex.annotations.SocketMapping;

import java.lang.reflect.Method;
import java.util.List;

public class AnnotationUtil {

	//
	public static void validAnnotation(List<Class<?>> clsList){
		if (clsList == null || clsList.size() <= 0){
			return;
		}
		for (Class<?> cls: clsList) {
			Method[] methods = cls.getDeclaredMethods();
			if (methods.length <= 0){
				return;
			}
			for (Method method : methods) {
				SocketMapping socketMapping = method.getAnnotation(SocketMapping.class);
				if (socketMapping != null) {
					// 类名 方法名
					MethodMapping.addMapping(socketMapping.value(), method);
				}
			}
		}
	}
}